<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>修改医生信息</title>
    <base th:href="${#request.getContextPath()}+'/'">
    <link rel="stylesheet" href="/static/layui/css/layui.css" th:href="@{/static/layui/css/layui.css}">

    <style type="text/css">

    </style>
</head>

<body style="width: 800px;height: 600px;">
<!--编辑表单-->
<div id="editBook">
    <form class="layui-form" id="saveBook" style="margin-top:10px">
        <input type="hidden" name="id" id="id" th:value="${doctor.id}">

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">医生卡号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="docid" id="docid" required lay-verify="required" autocomplete="off"
                               class="layui-input" placeholder="必填" th:value="${doctor.docid}">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">医生姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="docname" id="docname" required lay-verify="required" autocomplete="off"
                               class="layui-input" placeholder="必填" th:value="${doctor.docname}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">所属科室</label>
                    <div class="layui-input-inline">
                        <select name ="doctype" lay-filter="levelM" >
                            <option value ="内科" th:field="*{doctor.doctype}">内科</option>
                            <option value ="外科" th:field="*{doctor.doctype}">外科</option>
                            <option value ="妇科" th:field="*{doctor.doctype}">妇科</option>
                            <option value ="儿科" th:field="*{doctor.doctype}">儿科</option>
                            <option value ="肿瘤科" th:field="*{doctor.doctype}">肿瘤科</option>
                            <option value ="男科" th:field="*{doctor.doctype}">男科</option>
                            <option value ="五官科" th:field="*{doctor.doctype}">五官科</option>
                            <option value ="皮肤科" th:field="*{doctor.doctype}">皮肤科</option>
                            <option value ="精神课" th:field="*{doctor.doctype}">精神课</option>
                            <option value ="传染科" th:field="*{doctor.doctype}">传染科</option>
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">今日温度</label>
                    <div class="layui-input-inline">
                    <input type="text" name="temp" id="temp" lay-verify="" autocomplete="off"
                           class="layui-input" th:value="${doctor.temp}">
                    </div>
                </div>

            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-inline">
                    <input type="text" name="phone" id="phone" lay-verify="" autocomplete="off"
                           class="layui-input" th:value="${doctor.phone}">
                    </div>
                </div>

            </div>
<!--            <div class="layui-form-item">-->
<!--                <div class="layui-inline">-->
<!--                    <label class="layui-form-label">是否打卡</label>-->
<!--                    <div class="layui-input-inline">-->
<!--                        <select name ="ispost" lay-filter="levelM" >-->
<!--                            <option value ="1" th:field="*{doctor.ispost}">已打卡</option>-->
<!--                            <option value ="2" th:field="*{doctor.ispost}">未打卡</option>-->
<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->

            <div class="layui-form-item" style="margin-top:40px" id="check">
                <div class="layui-input-block">
                    <button class="layui-btn  layui-btn-submit " lay-submit="" lay-filter="saveBook">保存</button>
                    <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
                </div>
            </div>
    </form>
</div>


<script src="/static/js/jquery-1.11.3.min.js" th:src="@{/static/js/jquery-1.11.3.min.js}"></script>
<script src="/static/layui/layui.all.js" th:src="@{/static/layui/layui.all.js}"></script>
<script src="/static/js/util.js" th:src="@{/static/js/util.js}"></script>

<!--ctx-->
<script th:replace="~{fragment::ctx}"/>

<script>
    var element, layer, laydate, form;

    $(function () {

        // 使用模块
        layui.use(['element', 'layer', 'laydate', 'form'], function () {
            element = layui.element;
            layer = layui.layer;
            laydate = layui.laydate;
            form = layui.form;
        });

        form.verify({
            integer:[
                /^[0-9]\d*$/
                ,'只能输入整数！'
            ]
        });


        //监听表单提交
        // 修改
        form.on('submit(saveBook)', function (data) {

            $.ajax({
                url: ctx+'api/doctor/save',
                type: 'POST',
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(data.field),
                success: function (result) {
                    if (result.code == 200) {
                        cleanForm("#saveBook");
                        top.layer.closeAll();//关闭所有的弹出层
                        top.$(".layui-show").find("iframe")[0].contentWindow.userTable.reload();
                    } else {
                        layer.alert(result.message);
                    }
                }
            });

            return false;

        });
    });


</script>
</body>

</html>